import React, { useEffect } from "react";
import Taro, {
  useDidShow,
  useDidHide,
  useLaunch,
  getCurrentInstance,
} from "@tarojs/taro";
import { GlobalDataProvider } from "./store";
import "./i18next";
// 全局样式
import "./app.scss";

function App(props) {
  const { router } = getCurrentInstance();
  const { params } = router || {};

  useLaunch(() => {
    const { platform = "obp" } = params || {};
    console.log("App Launch", platform);
    Taro.setStorageSync("platform", platform);
  });

  // 对应 onShow
  useDidShow(() => {});

  // 对应 onHide
  useDidHide(() => {});

  return <GlobalDataProvider>{props.children}</GlobalDataProvider>;
}

export default App;
